<?php
class Controller extends BaseController {
/**
     * view elments
     * @var mixed array
     */
    private   $_view            = array();
	/**
	 * view templates include path
	 * @var string
	 */
	protected static $_viewPath = NULL;
	
	public function __construct() {
		$args = func_get_args();
		call_user_func_array(array('parent', '__construct'), $args);
		/**
		 * user login status checking hooker
		 * 
		 */
		User::isLogined();
	}
	/**
	 * set the view elments
	 * @param string $key
	 * @param mixed $value
	 */
	public function setElement($key, $value) {
        $this->_view[$key] = $value;
    }
	/**
	 * output the view template
	 * @param string $tplFile
	 * @param bool $exit
	 */
	public function output($tplFile, $exit = NULL) {
        $tpl = new View();
        $tpl->assign($this->_view);
        $tpl->display($tplFile);
		if( !is_null($exit) ) {
			$this->stop($exit);
		}
    }
	/**
	 * set the view include path
	 * @param string $path
	 */
	public function setViewPath($path) {
		self::$_viewPath = $path;
	}
	/**
	 * get the view include path
	 * @return string
	 */
	public function getViewPath() {
		return self::$_viewPath;
	}
}